home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 5.0 KB | 143 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWPPobRd.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWPPOBRD_H
- #define FWPPOBRD_H
-
- #ifndef FWTXTBOX_H
- #include "FWTxtBox.h"
- #endif
-
- //========================================================================================
- // Forward declarations
- //========================================================================================
-
- class FW_CReadableStream;
- class FW_CSuperView;
- class FW_CFrame;
- class FW_MReceiver;
- class FW_CScrollBarScroller;
- struct Environment;
- class FW_CPPobScrollBarScroller;
- class FW_PResourceFile;
- class FW_PFileSpecification;
- class FW_CString;
- class FW_CFont;
-
- //========================================================================================
- // Some PowerPlant Types & Constants
- //========================================================================================
-
- // PowerPlant resource types
- #define FW_kPPobType 'PPob'
- #define FW_kRidLType 'RidL'
- #define FW_kWINDType 'WIND'
-
- typedef short ResIDT;
- typedef long PaneIDT;
- typedef long ClassIDT;
-
- typedef void* (*ClassCreatorFunc)(Environment*, FW_CReadableStream&, ClassIDT);
-
- #pragma options align=mac68k
-
- typedef struct ClassTable {
- ClassIDT classID;
- ClassCreatorFunc creatorFunc;
- } ClassTable, *ClassTableP, **ClassTableH;
-
- #pragma options align=reset
-
- // New ODF error (to move later to FWErrors.h). Also defined in FWMARead.h
- #ifndef FW_xWrongViewResourceVersion
- #define FW_xWrongViewResourceVersion -30215
- #endif
-
- // Macro
- #define PPOB_WARNING(str) if(FW_CPPobReader::gUseDebugWarnings) FW_DEBUG_MESSAGE(str)
-
- //========================================================================================
- // class FW_CPPobReader
- //========================================================================================
-
- class FW_CPPobReader {
- public:
- enum EResourceFileKind { kPartOnly, kPartOrAskUser, kCurrentResFile, kNewResFile };
- enum EErrorKind { kNoError, kNoViewResource, kStreamReadError };
-
- // Class registration
- static void RegisterAllPPClasses();
- static void RegisterClass(ClassIDT inClassID, ClassCreatorFunc inCreatorFunc);
-
- // Main entry point to load PPob views
- static FW_PlatformError CreateSubViewsFromPPobResource(Environment* ev,
- FW_ResourceID resourceID,
- FW_CSuperView* superview,
- FW_MReceiver* receiver,
- EResourceFileKind resFileKind,
- FW_Boolean useDebugWarnings = true);
-
- // Dynamic reloading of views
- static FW_PlatformError ReloadViews(Environment* ev,
- FW_ResourceID resourceID,
- FW_CFrame* frame,
- FW_MReceiver* receiver,
- EResourceFileKind resFileKind,
- FW_Boolean useDebugWarnings = true);
-
- // Utilities
- static void UseClassAlias(FW_Boolean flag) { gUseClassAlias = flag; };
- static FW_Boolean FoundViewWithAlias() { return gFoundViewWithAlias; };
- static FW_PResourceFile* GetResFile(Environment* ev, EResourceFileKind resFileKind);
- static FW_Boolean HasResFile() { return (gCurResFileSpec != 0); } ;
- static void GetResFileName(Environment* ev, FW_CString& name);
- static FW_CString ReadStr255(FW_CReadableStream& stream);
- static void GetTextTraits(short textTraitsID,
- FW_CFont& font,
- FW_TextBoxOptions& horizJust,
- FW_CColor& color);
-
- // For internal use
- private:
- static void* CreateObject(Environment* ev, FW_CReadableStream& inStream,
- ClassIDT classID, ClassIDT oldClassID);
-
- static void* ReadWindowPPob(Environment* ev, FW_CReadableStream& strean, ClassIDT id);
- static void* ReadDialogPPob(Environment* ev, FW_CReadableStream& strean, ClassIDT id);
-
- static void LinkReceiverToControls(Environment* ev, FW_MReceiver* receiver,
- FW_CSuperView* container, FW_ResourceID resourceID);
- static void DisposeClassTable();
- static void* CreateUnknowView(Environment* ev, FW_CReadableStream& inStream, ClassIDT inClassID);
- static short FetchClassIndex(ClassIDT inClassID);
- static void ObjectsFromStream(Environment* ev, FW_CReadableStream& stream);
- static void SetWindow(Environment* ev, FW_PResourceFile& resFile, FW_ResourceID resourceID);
- static void PrivLinkReceiver(Environment* ev, FW_PResourceFile& resFile,
- FW_MReceiver* receiver, FW_CSuperView* container, FW_ResourceID resourceID);
- static void PostCreateViewFromStream(Environment* ev, FW_CSuperView* view);
-
- // Class globales
- public:
- static FW_CSuperView* gDefaultSuperView;
- static FW_CPPobScrollBarScroller* gScroller;
- static PaneIDT gDefaultButtonID;
- static PaneIDT gCancelButtonID;
- static FW_Boolean gUseDebugWarnings;
-
- private:
- static short gClassCount;
- static ClassTableH gTableH;
- static FW_PFileSpecification* gCurResFileSpec;
- static FW_Boolean gUseClassAlias;
- static FW_Boolean gFoundViewWithAlias;
- };
-
-
- #endif
-